import type { GeneratedEtsLibFile } from "../../types/generated";

export const FILE: GeneratedEtsLibFile = {
  path: 'ets/api/@ohos.worker.d.ts',
  content: "/*\n * Copyright (c) 2021 Huawei Device Co., Ltd.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n/**\n * @file\n * @kit ArkTS\n */\n/**\n * @typedef WorkerOptions\n * Provides options that can be set for the worker to create.\n * @syscap SystemCapability.Utils.Lang\n * @since 7\n */\n/**\n * @typedef WorkerOptions\n * Provides options that can be set for the worker to create.\n * @syscap SystemCapability.Utils.Lang\n * @crossplatform\n * @since 10\n */\n/**\n * @typedef WorkerOptions\n * Provides options that can be set for the Worker instance to create.\n * @syscap SystemCapability.Utils.Lang\n * @crossplatform\n * @atomicservice\n * @since 11\n */\nexport interface WorkerOptions {\n    /**\n     * Mode in which the worker executes the script.\n     *\n     * @syscap SystemCapability.Utils.Lang\n     * @since 7\n     */\n    /**\n     * Mode in which the worker executes the script.\n     *\n     * @syscap SystemCapability.Utils.Lang\n     * @crossplatform\n     * @since 10\n     */\n    /**\n     * Mode in which the Worker instance executes the script. The module type is not supported yet. The default value is classic.\n     *\n     * @type { ?('classic' | 'module') }\n     * @syscap SystemCapability.Utils.Lang\n     * @crossplatform\n     * @atomicservice\n     * @since 11\n     */\n    type?: 'classic' | 'module';\n    /**\n     * Name of the worker.\n     *\n     * @syscap SystemCapability.Utils.Lang\n     * @since 7\n     */\n    /**\n     * Name of the worker.\n     *\n     * @syscap SystemCapability.Utils.Lang\n     * @crossplatform\n     * @since 10\n     */\n    /**\n     * Name of the Worker thread. The default value is undefined.\n     *\n     * @type { ?string }\n     * @syscap SystemCapability.Utils.Lang\n     * @crossplatform\n     * @atomicservice\n     * @since 11\n     */\n    name?: string;\n    /**\n     * Whether the worker is shared.\n     *\n     * @syscap SystemCapability.Utils.Lang\n     * @since 7\n     */\n    /**\n     * Whether the worker is shared.\n     *\n     * @syscap SystemCapability.Utils.Lang\n     * @crossplatform\n     * @since 10\n     */\n    /**\n     * Whether sharing of the Worker instance is enabled. Currently, sharing is not supported.\n     *\n     * @type { ?boolean }\n     * @syscap SystemCapability.Utils.Lang\n     * @crossplatform\n     * @atomicservice\n     * @since 12\n     */\n    shared?: boolean;\n    /**\n     * Priority of the Worker thread.\n     *\n     * @type { ?ThreadWorkerPriority }\n     * @syscap SystemCapability.Utils.Lang\n     * @atomicservice\n     * @since 18\n     */\n    priority?: ThreadWorkerPriority;\n}\n/**\n * Enumerates the priorities available for Worker threads. For details about the mappings between priorities and QoS levels, see QoS Level.\n *\n * @enum { number } ThreadWorkerPriority\n * @syscap SystemCapability.Utils.Lang\n * @atomicservice\n * @since 18\n */\nexport enum ThreadWorkerPriority {\n    /**\n     * High priority, corresponding to QOS_USER_INITIATED.\n     *\n     * @syscap SystemCapability.Utils.Lang\n     * @atomicservice\n     * @since 18\n     */\n    HIGH = 0,\n    /**\n     * Medium priority, corresponding to QOS_DEFAULT.\n     *\n     * @syscap SystemCapability.Utils.Lang\n     * @atomicservice\n     * @since 18\n     */\n    MEDIUM = 1,\n    /**\n     * Low priority, corresponding to QOS_UTILITY.\n     *\n     * @syscap SystemCapability.Utils.Lang\n     * @atomicservice\n     * @since 18\n     */\n    LOW = 2,\n    /**\n     * Background priority, corresponding to QOS_BACKGROUND.\n     *\n     * @syscap SystemCapability.Utils.Lang\n     * @atomicservice\n     * @since 18\n     */\n    IDLE = 3\n}\n/**\n * @typedef Event\n * Defines the event.\n * @syscap SystemCapability.Utils.Lang\n * @since 7\n */\n/**\n * @typedef Event\n * Defines the event.\n * @syscap SystemCapability.Utils.Lang\n * @crossplatform\n * @since 10\n */\n/**\n * @typedef Event\n * Defines the event.\n * @syscap SystemCapability.Utils.Lang\n * @crossplatform\n * @atomicservice\n * @since 11\n */\nexport interface Event {\n    /**\n     * Type of the Event.\n     *\n     * @syscap SystemCapability.Utils.Lang\n     * @since 7\n     */\n    /**\n     * Type of the Event.\n     *\n     * @syscap SystemCapability.Utils.Lang\n     * @crossplatform\n     * @since 10\n     */\n    /**\n     * Type of the Event.\n     *\n     * @type { string }\n     * @readonly\n     * @syscap SystemCapability.Utils.Lang\n     * @crossplatform\n     * @atomicservice\n     * @since 12\n     */\n    readonly type: string;\n    /**\n     * Timestamp(accurate to millisecond) when the event is created.\n     *\n     * @syscap SystemCapability.Utils.Lang\n     * @since 7\n     */\n    /**\n     * Timestamp(accurate to millisecond) when the event is created.\n     *\n     * @syscap SystemCapability.Utils.Lang\n     * @crossplatform\n     * @since 10\n     */\n    /**\n     * Timestamp (accurate to millisecond) when the event is created. This parameter is not supported yet.\n     *\n     * @type { number }\n     * @readonly\n     * @syscap SystemCapability.Utils.Lang\n     * @crossplatform\n     * @atomicservice\n     * @since 12\n     */\n    readonly timeStamp: number;\n}\n/**\n * Provides detailed information about the exception occurred during worker execution.\n * @typedef ErrorEvent\n * @syscap SystemCapability.Utils.Lang\n * @since 7\n */\n/**\n * Provides detailed information about the exception occurred during worker execution.\n * @typedef ErrorEvent\n * @syscap SystemCapability.Utils.Lang\n * @crossplatform\n * @since 10\n */\n/**\n * Provides detailed information about the exception that occurs during worker execution. The ErrorEvent class inherits from Event.\n * @typedef ErrorEvent\n * @extends Event\n * @syscap SystemCapability.Utils.Lang\n * @crossplatform\n * @atomicservice\n * @since 11\n */\nexport interface ErrorEvent extends Event {\n    /**\n     * Information about the exception.\n     *\n     * @syscap SystemCapability.Utils.Lang\n     * @since 7\n     */\n    /**\n     * Information about the exception.\n     *\n     * @syscap SystemCapability.Utils.Lang\n     * @crossplatform\n     * @since 10\n     */\n    /**\n     * Information about the exception.\n     *\n     * @type { string }\n     * @readonly\n     * @syscap SystemCapability.Utils.Lang\n     * @crossplatform\n     * @atomicservice\n     * @since 11\n     */\n    readonly message: string;\n    /**\n     * File where the exception is located.\n     *\n     * @syscap SystemCapability.Utils.Lang\n     * @since 7\n     */\n    /**\n     * File where the exception is located.\n     *\n     * @syscap SystemCapability.Utils.Lang\n     * @crossplatform\n     * @since 10\n     */\n    /**\n     * File where the exception is located.\n     *\n     * @type { string }\n     * @readonly\n     * @syscap SystemCapability.Utils.Lang\n     * @crossplatform\n     * @atomicservice\n     * @since 11\n     */\n    readonly filename: string;\n    /**\n     * Number of the line where the exception is located.\n     *\n     * @syscap SystemCapability.Utils.Lang\n     * @since 7\n     */\n    /**\n     * Number of the line where the exception is located.\n     *\n     * @syscap SystemCapability.Utils.Lang\n     * @crossplatform\n     * @since 10\n     */\n    /**\n     * Serial number of the line where the exception is located.\n     *\n     * @type { number }\n     * @readonly\n     * @syscap SystemCapability.Utils.Lang\n     * @crossplatform\n     * @atomicservice\n     * @since 11\n     */\n    readonly lineno: number;\n    /**\n     * Number of the column where the exception is located.\n     *\n     * @syscap SystemCapability.Utils.Lang\n     * @since 7\n     */\n    /**\n     * Number of the column where the exception is located.\n     *\n     * @syscap SystemCapability.Utils.Lang\n     * @crossplatform\n     * @since 10\n     */\n    /**\n     * Serial number of the column where the exception is located.\n     *\n     * @type { number }\n     * @readonly\n     * @syscap SystemCapability.Utils.Lang\n     * @crossplatform\n     * @atomicservice\n     * @since 11\n     */\n    readonly colno: number;\n    /**\n     * Type of the exception.\n     *\n     * @syscap SystemCapability.Utils.Lang\n     * @since 7\n     */\n    /**\n     * Type of the exception.\n     *\n     * @syscap SystemCapability.Utils.Lang\n     * @crossplatform\n     * @since 10\n     */\n    /**\n     * Type of the exception.\n     *\n     * @type { Object }\n     * @readonly\n     * @syscap SystemCapability.Utils.Lang\n     * @crossplatform\n     * @atomicservice\n     * @since 11\n     */\n    readonly error: Object;\n}\n/**\n * Holds the data transferred between worker threads.\n * @typedef MessageEvent<T>\n * @syscap SystemCapability.Utils.Lang\n * @since 7\n */\n/**\n * Holds the data transferred between worker threads.\n * @typedef MessageEvent<T>\n * @syscap SystemCapability.Utils.Lang\n * @crossplatform\n * @since 10\n */\n/**\n * Holds the data transferred between worker threads.\n * @typedef MessageEvent<T>\n * @extends Event\n * @syscap SystemCapability.Utils.Lang\n * @crossplatform\n * @atomicservice\n * @since 12\n */\nexport interface MessageEvent<T> extends Event {\n    /**\n     * Data transferred when an exception occurs.\n     *\n     * @syscap SystemCapability.Utils.Lang\n     * @since 7\n     */\n    /**\n     * Data transferred when an exception occurs.\n     *\n     * @syscap SystemCapability.Utils.Lang\n     * @crossplatform\n     * @since 10\n     */\n    /**\n     * Data transferred when an exception occurs.\n     *\n     * @type { T }\n     * @readonly\n     * @syscap SystemCapability.Utils.Lang\n     * @crossplatform\n     * @atomicservice\n     * @since 12\n     */\n    readonly data: T;\n}\n/**\n * Saves the data transferred between worker thread and host thread.\n * @typedef MessageEvents\n * @syscap SystemCapability.Utils.Lang\n * @since 9\n */\n/**\n * Saves the data transferred between worker thread and host thread.\n * @typedef MessageEvents\n * @syscap SystemCapability.Utils.Lang\n * @crossplatform\n * @since 10\n */\n/**\n * Holds the data transferred between Worker threads.\n * @typedef MessageEvents\n * @extends Event\n * @syscap SystemCapability.Utils.Lang\n * @crossplatform\n * @atomicservice\n * @since 11\n */\nexport interface MessageEvents extends Event {\n    /**\n     * Data transferred when an exception occurs.\n     *\n     * @type { any }\n     * @syscap SystemCapability.Utils.Lang\n     * @since 9\n     */\n    /**\n     * Data transferred when an exception occurs.\n     *\n     * @type { any }\n     * @syscap SystemCapability.Utils.Lang\n     * @crossplatform\n     * @since 10\n     */\n    /**\n     * Data transferred when an exception occurs.\n     *\n     * @type { any }\n     * @readonly\n     * @syscap SystemCapability.Utils.Lang\n     * @crossplatform\n     * @atomicservice\n     * @since 11\n     */\n    readonly data: any;\n}\n/**\n * @typedef PostMessageOptions\n * Specifies the object whose ownership need to be transferred during data transfer.\n * The object must be ArrayBuffer.\n * @syscap SystemCapability.Utils.Lang\n * @since 7\n */\n/**\n * @typedef PostMessageOptions\n * Specifies the object whose ownership need to be transferred during data transfer.\n * The object must be ArrayBuffer.\n * @syscap SystemCapability.Utils.Lang\n * @crossplatform\n * @since 10\n */\n/**\n * @typedef PostMessageOptions\n * Defines the object for which the ownership is to be transferred during data transfer. The object must be an ArrayBuffer instance.\n * After the ownership is transferred, the object becomes unavailable in the sender and can be used only in the receiver.\n * @syscap SystemCapability.Utils.Lang\n * @crossplatform\n * @atomicservice\n * @since 11\n */\nexport interface PostMessageOptions {\n    /**\n     * ArrayBuffer array used to transfer the ownership.\n     *\n     * @syscap SystemCapability.Utils.Lang\n     * @since 7\n     */\n    /**\n     * ArrayBuffer array used to transfer the ownership.\n     *\n     * @syscap SystemCapability.Utils.Lang\n     * @crossplatform\n     * @since 10\n     */\n    /**\n     * ArrayBuffer array used to transfer the ownership. The array cannot be null.\n     *\n     * @type { ?Object[] }\n     * @syscap SystemCapability.Utils.Lang\n     * @crossplatform\n     * @atomicservice\n     * @since 11\n     */\n    transfer?: Object[];\n}\n/**\n * @typedef EventListener\n * Implements event listening.\n * @syscap SystemCapability.Utils.Lang\n * @since 7\n * @deprecated since 9\n * @useinstead ohos.worker.WorkerEventListener\n */\nexport interface EventListener {\n    /**\n     * Specifies the callback to invoke.\n     *\n     * @param { Event } evt - evt evt Event class for the callback to invoke.\n     * @returns { void | Promise<void> }\n     * @syscap SystemCapability.Utils.Lang\n     * @since 7\n     * @deprecated since 9\n     * @useinstead ohos.worker.WorkerEventListener.(event: Event)\n     */\n    (evt: Event): void | Promise<void>;\n}\n/**\n * @typedef WorkerEventListener\n * Implements event listening.\n * @syscap SystemCapability.Utils.Lang\n * @since 9\n */\n/**\n * @typedef WorkerEventListener\n * Implements event listening.\n * @syscap SystemCapability.Utils.Lang\n * @crossplatform\n * @since 10\n */\n/**\n * @typedef WorkerEventListener\n * Implements event listening.\n * @syscap SystemCapability.Utils.Lang\n * @crossplatform\n * @atomicservice\n * @since 12\n */\nexport interface WorkerEventListener {\n    /**\n     * Specifies the callback function to be invoked.\n     *\n     * @param { Event } event - event Event class for the callback to invoke.\n     * @returns { void | Promise<void> }\n     * @throws { BusinessError } 401 - Parameter error. Possible causes:\n     * 1.Mandatory parameters are left unspecified;\n     * 2.Incorrect parameter types;\n     * 3.Parameter verification failed.\n     * @throws { BusinessError } 10200004 - The Worker instance is not running.\n     * @throws { BusinessError } 10200005 - The called API is not supported in the worker thread.\n     * @syscap SystemCapability.Utils.Lang\n     * @since 9\n     */\n    /**\n     * Specifies the callback function to be invoked.\n     *\n     * @param { Event } event - event Event class for the callback to invoke.\n     * @returns { void | Promise<void> }\n     * @throws { BusinessError } 401 - Parameter error. Possible causes:\n     * 1.Mandatory parameters are left unspecified;\n     * 2.Incorrect parameter types;\n     * 3.Parameter verification failed.\n     * @throws { BusinessError } 10200004 - The Worker instance is not running.\n     * @throws { BusinessError } 10200005 - The called API is not supported in the worker thread.\n     * @syscap SystemCapability.Utils.Lang\n     * @crossplatform\n     * @since 10\n     */\n    /**\n     * Specifies the callback function to be invoked.\n     *\n     * @param { Event } event - Event class for the callback to invoke.\n     * @returns { void | Promise<void> }\n     * @throws { BusinessError } 401 - Parameter error. Possible causes:\n     * 1.Mandatory parameters are left unspecified;\n     * 2.Incorrect parameter types;\n     * 3.Parameter verification failed.\n     * @throws { BusinessError } 10200004 - Worker instance is not running.\n     * @throws { BusinessError } 10200005 - The invoked API is not supported in workers.\n     * @syscap SystemCapability.Utils.Lang\n     * @crossplatform\n     * @atomicservice\n     * @since 12\n     */\n    (event: Event): void | Promise<void>;\n}\n/**\n * Type of message, only \"message\" and \"messageerror\".\n *\n * @syscap SystemCapability.Utils.Lang\n * @since 7\n */\n/**\n * Type of message, only \"message\" and \"messageerror\".\n *\n * @syscap SystemCapability.Utils.Lang\n * @crossplatform\n * @since 10\n */\n/**\n * Type of message, only \"message\" and \"messageerror\".\n *\n * @typedef { 'message' | 'messageerror' }\n * @syscap SystemCapability.Utils.Lang\n * @crossplatform\n * @atomicservice\n * @since 12\n */\ntype MessageType = 'message' | 'messageerror';\n/**\n * @typedef EventTarget\n * Specific event features.\n * @syscap SystemCapability.Utils.Lang\n * @since 7\n * @deprecated since 9\n * @useinstead ohos.worker.WorkerEventTarget\n */\nexport interface EventTarget {\n    /**\n     * Adds an event listener to the worker.\n     *\n     * @param { string } type - type Type of the event to listen for.\n     * @param { EventListener } listener - listener Callback to invoke when an event of the specified type occurs.\n     * @syscap SystemCapability.Utils.Lang\n     * @since 7\n     * @deprecated since 9\n     * @useinstead ohos.worker.WorkerEventTarget.addEventListener\n     */\n    addEventListener(type: string, listener: EventListener): void;\n    /**\n     * Dispatches the event defined for the worker.\n     *\n     * @param { Event } event - event Event to dispatch.\n     * @returns { boolean }\n     * @syscap SystemCapability.Utils.Lang\n     * @since 7\n     * @deprecated since 9\n     * @useinstead ohos.worker.WorkerEventTarget.dispatchEvent\n     */\n    dispatchEvent(event: Event): boolean;\n    /**\n     * Removes an event defined for the worker.\n     *\n     * @param { string } type - type Type of the event for which the event listener is removed.\n     * @param { EventListener } callback - callback Callback of the event listener to remove.\n     * @syscap SystemCapability.Utils.Lang\n     * @since 7\n     * @deprecated since 9\n     * @useinstead ohos.worker.WorkerEventTarget.removeEventListener\n     */\n    removeEventListener(type: string, callback?: EventListener): void;\n    /**\n     * Removes all event listeners for the worker.\n     *\n     * @syscap SystemCapability.Utils.Lang\n     * @since 7\n     * @deprecated since 9\n     * @useinstead ohos.worker.WorkerEventTarget.removeAllListener\n     */\n    removeAllListener(): void;\n}\n/**\n * @typedef WorkerEventTarget\n * Specific worker event features.\n * @syscap SystemCapability.Utils.Lang\n * @since 9\n */\n/**\n * @typedef WorkerEventTarget\n * Specific worker event features.\n * @syscap SystemCapability.Utils.Lang\n * @crossplatform\n * @since 10\n */\n/**\n * @typedef WorkerEventTarget\n * Processes worker listening events.\n * @syscap SystemCapability.Utils.Lang\n * @crossplatform\n * @atomicservice\n * @since 11\n */\nexport interface WorkerEventTarget {\n    /**\n     * Adds an event listener to the worker.\n     *\n     * @param { string } type - type Type of the event to listen for.\n     * @param { WorkerEventListener } listener - listener Callback to invoke when an event of the specified type occurs.\n     * @throws { BusinessError } 401 - Parameter error. Possible causes:\n     * 1.Mandatory parameters are left unspecified;\n     * 2.Incorrect parameter types;\n     * 3.Parameter verification failed.\n     * @throws { BusinessError } 10200004 - The Worker instance is not running.\n     * @throws { BusinessError } 10200005 - The called API is not supported in the worker thread.\n     * @syscap SystemCapability.Utils.Lang\n     * @since 9\n     */\n    /**\n     * Adds an event listener to the worker.\n     *\n     * @param { string } type - type Type of the event to listen for.\n     * @param { WorkerEventListener } listener - listener Callback to invoke when an event of the specified type occurs.\n     * @throws { BusinessError } 401 - Parameter error. Possible causes:\n     * 1.Mandatory parameters are left unspecified;\n     * 2.Incorrect parameter types;\n     * 3.Parameter verification failed.\n     * @throws { BusinessError } 10200004 - The Worker instance is not running.\n     * @throws { BusinessError } 10200005 - The called API is not supported in the worker thread.\n     * @syscap SystemCapability.Utils.Lang\n     * @since 10\n     */\n    /**\n     * Adds an event listener to the worker.\n     *\n     * @param { string } type - type Type of the event to listen for.\n     * @param { WorkerEventListener } listener - listener Callback to invoke when an event of the specified type occurs.\n     * @throws { BusinessError } 401 - Parameter error. Possible causes:\n     * 1.Mandatory parameters are left unspecified;\n     * 2.Incorrect parameter types;\n     * 3.Parameter verification failed.\n     * @throws { BusinessError } 10200004 - The Worker instance is not running.\n     * @throws { BusinessError } 10200005 - The called API is not supported in the worker thread.\n     * @syscap SystemCapability.Utils.Lang\n     * @crossplatform\n     * @since 11\n     */\n    /**\n     * Adds an event listener for the Worker thread. This API provides the same functionality as on9+.\n     *\n     * @param { string } type - type Type of the event to listen for.\n     * @param { WorkerEventListener } listener - listener Callback to invoke when an event of the specified type occurs.\n     * @throws { BusinessError } 401 - Parameter error. Possible causes:\n     * 1.Mandatory parameters are left unspecified;\n     * 2.Incorrect parameter types;\n     * 3.Parameter verification failed.\n     * @throws { BusinessError } 10200004 - The Worker instance is not running.\n     * @throws { BusinessError } 10200005 - The called API is not supported in the worker thread.\n     * @syscap SystemCapability.Utils.Lang\n     * @crossplatform\n     * @atomicservice\n     * @since 12\n     */\n    addEventListener(type: string, listener: WorkerEventListener): void;\n    /**\n     * Handle the event defined for the worker.\n     *\n     * @param { Event } event - event Event to dispatch.\n     * @returns { boolean }\n     * @throws { BusinessError } 401 - Parameter error. Possible causes:\n     * 1.Mandatory parameters are left unspecified;\n     * 2.Incorrect parameter types;\n     * 3.Parameter verification failed.\n     * @throws { BusinessError } 10200004 - The Worker instance is not running.\n     * @syscap SystemCapability.Utils.Lang\n     * @since 9\n     */\n    /**\n     * Handle the event defined for the worker.\n     *\n     * @param { Event } event - event Event to dispatch.\n     * @returns { boolean }\n     * @throws { BusinessError } 401 - Parameter error. Possible causes:\n     * 1.Mandatory parameters are left unspecified;\n     * 2.Incorrect parameter types;\n     * 3.Parameter verification failed.\n     * @throws { BusinessError } 10200004 - The Worker instance is not running.\n     * @syscap SystemCapability.Utils.Lang\n     * @crossplatform\n     * @since 10\n     */\n    /**\n     * Dispatches the event defined for the Worker thread.\n     *\n     * @param { Event } event - event Event to dispatch.\n     * @returns { boolean }\n     * @throws { BusinessError } 401 - Parameter error. Possible causes:\n     * 1.Mandatory parameters are left unspecified;\n     * 2.Incorrect parameter types;\n     * 3.Parameter verification failed.\n     * @throws { BusinessError } 10200004 - The Worker instance is not running.\n     * @syscap SystemCapability.Utils.Lang\n     * @crossplatform\n     * @atomicservice\n     * @since 12\n     */\n    dispatchEvent(event: Event): boolean;\n    /**\n     * Remove an event defined for the worker.\n     *\n     * @param { string } type - type Type of the event for which the event listener is cancelled.\n     * @param { WorkerEventListener } [callback] - callback Callback of the event listener to remove.\n     * @throws { BusinessError } 401 - Parameter error. Possible causes:\n     * 1.Mandatory parameters are left unspecified;\n     * 2.Incorrect parameter types;\n     * 3.Parameter verification failed.\n     * @throws { BusinessError } 10200004 - The Worker instance is not running.\n     * @syscap SystemCapability.Utils.Lang\n     * @since 9\n     */\n    /**\n     * Remove an event defined for the worker.\n     *\n     * @param { string } type - type Type of the event for which the event listener is cancelled.\n     * @param { WorkerEventListener } [callback] - callback Callback of the event listener to remove.\n     * @throws { BusinessError } 401 - Parameter error. Possible causes:\n     * 1.Mandatory parameters are left unspecified;\n     * 2.Incorrect parameter types;\n     * 3.Parameter verification failed.\n     * @throws { BusinessError } 10200004 - The Worker instance is not running.\n     * @syscap SystemCapability.Utils.Lang\n     * @crossplatform\n     * @since 10\n     */\n    /**\n     * Removes an event listener for the Worker thread. This API provides the same functionality as off9+.\n     *\n     * @param { string } type - type Type of the event for which the event listener is to be removed.\n     * @param { WorkerEventListener } [callback] - callback Callback to invoke when the listener is removed.\n     * @throws { BusinessError } 401 - Parameter error. Possible causes:\n     * 1.Mandatory parameters are left unspecified;\n     * 2.Incorrect parameter types;\n     * 3.Parameter verification failed.\n     * @throws { BusinessError } 10200004 - The Worker instance is not running.\n     * @syscap SystemCapability.Utils.Lang\n     * @crossplatform\n     * @atomicservice\n     * @since 12\n     */\n    removeEventListener(type: string, callback?: WorkerEventListener): void;\n    /**\n     * Remove all event listeners for the worker.\n     *\n     * @throws { BusinessError } 10200004 - The Worker instance is not running.\n     * @syscap SystemCapability.Utils.Lang\n     * @since 9\n     */\n    /**\n     * Remove all event listeners for the worker.\n     *\n     * @throws { BusinessError } 10200004 - The Worker instance is not running.\n     * @syscap SystemCapability.Utils.Lang\n     * @crossplatform\n     * @since 10\n     */\n    /**\n     * Removes all event listeners for the Worker thread.\n     *\n     * @throws { BusinessError } 10200004 - The Worker instance is not running.\n     * @syscap SystemCapability.Utils.Lang\n     * @crossplatform\n     * @atomicservice\n     * @since 12\n     */\n    removeAllListener(): void;\n}\n/**\n * @typedef WorkerGlobalScope\n * Specifies the worker thread running environment, which is isolated from the host thread environment.\n * @syscap SystemCapability.Utils.Lang\n * @since 7\n * @deprecated since 9\n * @useinstead ohos.worker.GlobalScope\n */\ndeclare interface WorkerGlobalScope extends EventTarget {\n    /**\n     * Worker name specified when there is a new worker.\n     *\n     * @syscap SystemCapability.Utils.Lang\n     * @since 7\n     * @deprecated since 9\n     * @useinstead ohos.worker.GlobalScope.name\n     */\n    readonly name: string;\n    /**\n     * The onerror attribute of parentPort specifies\n     * the event handler to be called when an exception occurs during worker execution.\n     * The event handler is executed in the worker thread.\n     *\n     * @syscap SystemCapability.Utils.Lang\n     * @since 7\n     * @deprecated since 9\n     * @useinstead ohos.worker.GlobalScope.onerror\n     */\n    onerror?: (ev: ErrorEvent) => void;\n    /**\n     * Specify the type attribute for self.\n     *\n     * @syscap SystemCapability.Utils.Lang\n     * @since 7\n     * @deprecated since 9\n     * @useinstead ohos.worker.GlobalScope.self\n     */\n    readonly self: WorkerGlobalScope & typeof globalThis;\n}\n/**\n * The environment Specified in which worker threads run, which is isolated from the host thread environment.\n * @typedef GlobalScope\n * @syscap SystemCapability.Utils.Lang\n * @since 9\n */\n/**\n * The environment Specified in which worker threads run, which is isolated from the host thread environment.\n * @typedef GlobalScope\n * @syscap SystemCapability.Utils.Lang\n * @crossplatform\n * @since 10\n */\n/**\n * Implements the running environment of the Worker thread. The GlobalScope class inherits from WorkerEventTarget.\n * @typedef GlobalScope\n * @extends WorkerEventTarget\n * @syscap SystemCapability.Utils.Lang\n * @crossplatform\n * @atomicservice\n * @since 11\n */\ndeclare interface GlobalScope extends WorkerEventTarget {\n    /**\n     * Name of Worker specified when there is a new worker.\n     *\n     * @syscap SystemCapability.Utils.Lang\n     * @since 9\n     */\n    /**\n     * Name of Worker specified when there is a new worker.\n     *\n     * @syscap SystemCapability.Utils.Lang\n     * @crossplatform\n     * @since 10\n     */\n    /**\n     * Worker instance specified when there is a new Worker instance.\n     *\n     * @type { string }\n     * @readonly\n     * @syscap SystemCapability.Utils.Lang\n     * @crossplatform\n     * @atomicservice\n     * @since 11\n     */\n    readonly name: string;\n    /**\n     * The onerror attribute of parentPort specified.\n     * the event handler to be called when an exception occurs during worker execution.\n     * The event handler is executed in the worker thread.\n     *\n     * @syscap SystemCapability.Utils.Lang\n     * @since 9\n     */\n    /**\n     * The onerror attribute of parentPort specified.\n     * the event handler to be called when an exception occurs during worker execution.\n     * The event handler is executed in the worker thread.\n     *\n     * @syscap SystemCapability.Utils.Lang\n     * @crossplatform\n     * @since 10\n     */\n    /**\n     * Called when an exception occurs during worker execution. The event handler is executed in the Worker thread.\n     * In the callback function, the ev type is ErrorEvent, indicating the received abnormal data.\n     *\n     * @type { ?function }\n     * @syscap SystemCapability.Utils.Lang\n     * @crossplatform\n     * @atomicservice\n     * @since 11\n     */\n    onerror?: (ev: ErrorEvent) => void;\n    /**\n     * Specify the type attribute for self.\n     *\n     * @syscap SystemCapability.Utils.Lang\n     * @since 9\n     */\n    /**\n     * Specify the type attribute for self.\n     *\n     * @syscap SystemCapability.Utils.Lang\n     * @crossplatform\n     * @since 10\n     */\n    /**\n     * GlobalScope itself.\n     *\n     * @type { GlobalScope & typeof globalThis }\n     * @readonly\n     * @syscap SystemCapability.Utils.Lang\n     * @crossplatform\n     * @atomicservice\n     * @since 11\n     */\n    readonly self: GlobalScope & typeof globalThis;\n}\n/**\n * @typedef DedicatedWorkerGlobalScope\n * Specifies the worker thread running environment, which is isolated from the host thread environment\n * @syscap SystemCapability.Utils.Lang\n * @since 7\n * @deprecated since 9\n * @useinstead ohos.worker.ThreadWorkerGlobalScope\n */\nexport interface DedicatedWorkerGlobalScope extends WorkerGlobalScope {\n    /**\n     * The onmessage attribute of parentPort specifies the event handler\n     * to be called then the worker thread receives a message sent by\n     * the host thread through worker postMessage.\n     * The event handler is executed in the worker thread.\n     *\n     * @syscap SystemCapability.Utils.Lang\n     * @since 7\n     * @deprecated since 9\n     * @useinstead ohos.worker.ThreadWorkerGlobalScope.onmessage\n     */\n    onmessage?: (this: DedicatedWorkerGlobalScope, ev: MessageEvent) => void;\n    /**\n     * The onmessage attribute of parentPort specifies the event handler\n     * to be called then the worker receives a message that cannot be deserialized.\n     * The event handler is executed in the worker thread.\n     *\n     * @syscap SystemCapability.Utils.Lang\n     * @since 7\n     * @deprecated since 9\n     * @useinstead ohos.worker.ThreadWorkerGlobalScope.onmessageerror\n     */\n    onmessageerror?: (this: DedicatedWorkerGlobalScope, ev: MessageEvent) => void;\n    /**\n     * Close the worker thread to stop the worker from receiving messages\n     *\n     * @syscap SystemCapability.Utils.Lang\n     * @since 7\n     * @deprecated since 9\n     * @useinstead ohos.worker.ThreadWorkerGlobalScope.close\n     */\n    close(): void;\n    /**\n     * Send a message to be host thread from the worker\n     *\n     * @param { Object } messageObject - messageObject Data to be sent to the worker\n     * @param { Transferable[] } transfer - transfer array cannot contain null.\n     * @syscap SystemCapability.Utils.Lang\n     * @since 7\n     * @deprecated since 9\n     * @useinstead ohos.worker.ThreadWorkerGlobalScope.postMessage\n     */\n    postMessage(messageObject: Object, transfer: Transferable[]): void;\n    /**\n     * Send a message to be host thread from the worker\n     *\n     * @param { Object } messageObject - messageObject Data to be sent to the worker\n     * @param { PostMessageOptions } [options] - options Option can be set for postmessage.\n     * @syscap SystemCapability.Utils.Lang\n     * @since 7\n     * @deprecated since 9\n     * @useinstead ohos.worker.ThreadWorkerGlobalScope.postMessage\n     */\n    postMessage(messageObject: Object, options?: PostMessageOptions): void;\n    /**\n     * Send a message to host thread from the worker\n     *\n     * @param { Object } messageObject - messageObject Data to be sent to the worker\n     * @param { ArrayBuffer[] } transfer - transfer array cannot contain null.\n     * @syscap SystemCapability.Utils.Lang\n     * @since 9\n     * @deprecated since 9\n     */\n    postMessage(messageObject: Object, transfer: ArrayBuffer[]): void;\n}\n/**\n * Specifies the thread-worker running environment, which is isolated from the host-thread environment\n * @typedef ThreadWorkerGlobalScope\n * @syscap SystemCapability.Utils.Lang\n * @since 9\n */\n/**\n * Specifies the thread-worker running environment, which is isolated from the host-thread environment\n * @typedef ThreadWorkerGlobalScope\n * @syscap SystemCapability.Utils.Lang\n * @crossplatform\n * @since 10\n */\n/**\n * Implements communication between the Worker thread and the host thread. The postMessage API is used to send messages\n * to the host thread, and the close API is used to terminate the Worker thread. The ThreadWorkerGlobalScope class inherits from GlobalScope9+.\n * @typedef ThreadWorkerGlobalScope\n * @extends GlobalScope\n * @syscap SystemCapability.Utils.Lang\n * @crossplatform\n * @atomicservice\n * @since 11\n */\nexport interface ThreadWorkerGlobalScope extends GlobalScope {\n    /**\n     * The onmessage attribute of parentPort specifies the event handler\n     * to be called then the worker thread receives a message sent by\n     * the host thread through worker postMessage.\n     * The event handler is executed in the worker thread.\n     *\n     * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Incorrect parameter types.\n     * @throws { BusinessError } 10200004 - The Worker instance is not running.\n     * @throws { BusinessError } 10200005 - The called API is not supported in the worker thread.\n     * @syscap SystemCapability.Utils.Lang\n     * @since 9\n     */\n    /**\n     * The onmessage attribute of parentPort specifies the event handler\n     * to be called then the worker thread receives a message sent by\n     * the host thread through worker postMessage.\n     * The event handler is executed in the worker thread.\n     *\n     * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Incorrect parameter types.\n     * @throws { BusinessError } 10200004 - The Worker instance is not running.\n     * @throws { BusinessError } 10200005 - The called API is not supported in the worker thread.\n     * @syscap SystemCapability.Utils.Lang\n     * @crossplatform\n     * @since 10\n     */\n    /**\n     * Called when the Worker thread receives a message sent by the host thread through postMessage.\n     * The event handler is executed in the Worker thread. In the callback function, this indicates the caller's\n     * ThreadWorkerGlobalScope, and the ev type is MessageEvents, indicating the received message data.\n     *\n     * @type { ?function }\n     * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Incorrect parameter types.\n     * @throws { BusinessError } 10200004 - The Worker instance is not running.\n     * @throws { BusinessError } 10200005 - The called API is not supported in the worker thread.\n     * @syscap SystemCapability.Utils.Lang\n     * @crossplatform\n     * @atomicservice\n     * @since 11\n     */\n    onmessage?: (this: ThreadWorkerGlobalScope, ev: MessageEvents) => void;\n    /**\n     * The onmessage attribute of parentPort specifies the event handler\n     * to be called then the worker receives a message that cannot be deserialized.\n     * The event handler is executed in the worker thread.\n     *\n     * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Incorrect parameter types.\n     * @throws { BusinessError } 10200004 - The Worker instance is not running.\n     * @throws { BusinessError } 10200005 - The called API is not supported in the worker thread.\n     * @syscap SystemCapability.Utils.Lang\n     * @since 9\n     */\n    /**\n     * The onmessage attribute of parentPort specifies the event handler\n     * to be called then the worker receives a message that cannot be deserialized.\n     * The event handler is executed in the worker thread.\n     *\n     * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Incorrect parameter types.\n     * @throws { BusinessError } 10200004 - The Worker instance is not running.\n     * @throws { BusinessError } 10200005 - The called API is not supported in the worker thread.\n     * @syscap SystemCapability.Utils.Lang\n     * @crossplatform\n     * @since 10\n     */\n    /**\n     * Called when the Worker thread receives a message that cannot be deserialized. The event handler is executed\n     * in the Worker thread. In the callback function, this indicates the caller's ThreadWorkerGlobalScope,\n     * and the ev type is MessageEvents, indicating the received message data.\n     *\n     * @type { ?function }\n     * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Incorrect parameter types.\n     * @throws { BusinessError } 10200004 - The Worker instance is not running.\n     * @throws { BusinessError } 10200005 - The called API is not supported in the worker thread.\n     * @syscap SystemCapability.Utils.Lang\n     * @crossplatform\n     * @atomicservice\n     * @since 11\n     */\n    onmessageerror?: (this: ThreadWorkerGlobalScope, ev: MessageEvents) => void;\n    /**\n     * Close the worker thread to stop the worker from receiving messages\n     *\n     * @throws { BusinessError } 10200004 - The Worker instance is not running.\n     * @syscap SystemCapability.Utils.Lang\n     * @since 9\n     */\n    /**\n     * Close the worker thread to stop the worker from receiving messages\n     *\n     * @throws { BusinessError } 10200004 - The Worker instance is not running.\n     * @syscap SystemCapability.Utils.Lang\n     * @crossplatform\n     * @since 10\n     */\n    /**\n     * Terminates the Worker thread to stop it from receiving messages.\n     *\n     * @throws { BusinessError } 10200004 - The Worker instance is not running.\n     * @syscap SystemCapability.Utils.Lang\n     * @crossplatform\n     * @atomicservice\n     * @since 11\n     */\n    close(): void;\n    /**\n     * Send a message to host thread from the worker\n     *\n     * @param { Object } messageObject - messageObject Data to be sent to the worker\n     * @param { ArrayBuffer[] } transfer - transfer array cannot contain null.\n     * @throws { BusinessError } 401 - Parameter error. Possible causes:\n     * 1.Mandatory parameters are left unspecified;\n     * 2.Incorrect parameter types;\n     * 3.Parameter verification failed.\n     * @throws { BusinessError } 10200004 - The Worker instance is not running.\n     * @throws { BusinessError } 10200006 - An exception occurred during serialization.\n     * @syscap SystemCapability.Utils.Lang\n     * @since 9\n     */\n    /**\n     * Send a message to host thread from the worker\n     *\n     * @param { Object } messageObject - messageObject Data to be sent to the worker\n     * @param { ArrayBuffer[] } transfer - transfer array cannot contain null.\n     * @throws { BusinessError } 401 - Parameter error. Possible causes:\n     * 1.Mandatory parameters are left unspecified;\n     * 2.Incorrect parameter types;\n     * 3.Parameter verification failed.\n     * @throws { BusinessError } 10200004 - The Worker instance is not running.\n     * @throws { BusinessError } 10200006 - An exception occurred during serialization.\n     * @syscap SystemCapability.Utils.Lang\n     * @crossplatform\n     * @since 10\n     */\n    /**\n     * Sends a message from the Worker thread to the host thread by transferring object ownership.\n     *\n     * @param { Object } messageObject - Data to be sent to the host thread. The data object must be sequenceable.\n     *     For details about the supported parameter types, see Sequenceable Data Types.\n     * @param { ArrayBuffer[] } transfer - ArrayBuffer instance holding an array of objects for which the ownership\n     *     is transferred to the host thread. After the transfer, the objects are available only in the host thread. The array cannot be null.\n     * @throws { BusinessError } 401 - Parameter error. Possible causes:\n     * 1.Mandatory parameters are left unspecified;\n     * 2.Incorrect parameter types;\n     * 3.Parameter verification failed.\n     * @throws { BusinessError } 10200004 - The Worker instance is not running.\n     * @throws { BusinessError } 10200006 - An exception occurred during serialization.\n     * @syscap SystemCapability.Utils.Lang\n     * @crossplatform\n     * @atomicservice\n     * @since 11\n     */\n    postMessage(messageObject: Object, transfer: ArrayBuffer[]): void;\n    /**\n     * Send a message to be host thread from the worker\n     *\n     * @param { Object } messageObject - messageObject Data to be sent to the worker\n     * @param { PostMessageOptions } [options] - options Option can be set for postmessage.\n     * @throws { BusinessError } 401 - Parameter error. Possible causes:\n     * 1.Mandatory parameters are left unspecified;\n     * 2.Incorrect parameter types;\n     * 3.Parameter verification failed.\n     * @throws { BusinessError } 10200004 - The Worker instance is not running.\n     * @throws { BusinessError } 10200006 - An exception occurred during serialization.\n     * @syscap SystemCapability.Utils.Lang\n     * @since 9\n     */\n    /**\n     * Send a message to be host thread from the worker\n     *\n     * @param { Object } messageObject - messageObject Data to be sent to the worker\n     * @param { PostMessageOptions } [options] - options Option can be set for postmessage.\n     * @throws { BusinessError } 401 - Parameter error. Possible causes:\n     * 1.Mandatory parameters are left unspecified;\n     * 2.Incorrect parameter types;\n     * 3.Parameter verification failed.\n     * @throws { BusinessError } 10200004 - The Worker instance is not running.\n     * @throws { BusinessError } 10200006 - An exception occurred during serialization.\n     * @syscap SystemCapability.Utils.Lang\n     * @crossplatform\n     * @since 10\n     */\n    /**\n     * Sends a message from the Worker thread to the host thread by transferring object ownership or copying data.\n     *\n     * @param { Object } messageObject - Data to be sent to the host thread. The data object must be sequenceable.\n     *     For details about the supported parameter types, see Sequenceable Data Types.\n     * @param { PostMessageOptions } [options] - If this parameter is specified, it functions the same as ArrayBuffer[].\n     *     Specifically, the ownership of the objects in the array is transferred to the host thread and becomes unavailable in the Worker thread.\n     *     The objects are available only in the host thread. If this parameter is not specified, the default value undefined is used,\n     *     and information is transferred to the host thread by copying data.\n     * @throws { BusinessError } 401 - Parameter error. Possible causes:\n     * 1.Mandatory parameters are left unspecified;\n     * 2.Incorrect parameter types;\n     * 3.Parameter verification failed.\n     * @throws { BusinessError } 10200004 - The Worker instance is not running.\n     * @throws { BusinessError } 10200006 - An exception occurred during serialization.\n     * @syscap SystemCapability.Utils.Lang\n     * @crossplatform\n     * @atomicservice\n     * @since 11\n     */\n    postMessage(messageObject: Object, options?: PostMessageOptions): void;\n    /**\n     * Sends a message from the Worker thread to the host thread. In the message, a sendable object is passed by reference,\n     * and a non-sendable object is passed by serialization.\n     *\n     * @param { Object } message - Data to be sent to the host thread. The data object must be sequenceable or sendable.\n     *     For details about the supported sequenceable types, see Sequenceable Data Types.\n     *     For details about the supported sendable types, see Sendable Data Types.\n     * @param { ArrayBuffer[] } [transfer] - ArrayBuffer instance holding an array of objects for which the ownership is\n     *     transferred to the host thread. After the transfer, the objects are available only in the host thread.\n     *     The array cannot be null. The default value is an empty array.\n     * @throws { BusinessError } 401 - Parameter error. Possible causes:\n     * 1.Mandatory parameters are left unspecified;\n     * 2.Incorrect parameter types;\n     * 3.Parameter verification failed.\n     * @throws { BusinessError } 10200004 - The Worker instance is not running.\n     * @throws { BusinessError } 10200006 - An exception occurred during serialization.\n     * @syscap SystemCapability.Utils.Lang\n     * @crossplatform\n     * @atomicservice\n     * @since 12\n     */\n    postMessageWithSharedSendable(message: Object, transfer?: ArrayBuffer[]): void;\n    /**\n     * Send a global call on registered globalCallObject on host side and return the result synchronously\n     *\n     * @param { string } instanceName - the exact key used in registration\n     * @param { string } methodName - a string which is same to the method called on globalCallObject.\n     * @param { number } timeout - the specific milliseconds that will wait for result to return, between 0 and 5000.\n     * @param { Object[] } args - the method argument called on registered globalCallObject.\n     * @returns { Object } Return the result of method if it has a return value, otherwise return void.\n     * @throws { BusinessError } 401 - Parameter error. Possible causes:\n     * 1.Mandatory parameters are left unspecified;\n     * 2.Incorrect parameter types;\n     * 3.Parameter verification failed.\n     * @throws { BusinessError } 10200004 - The Worker instance is not running.\n     * @throws { BusinessError } 10200006 - An exception occurred during serialization.\n     * @throws { BusinessError } 10200019 - The globalCallObject is not registered.\n     * @throws { BusinessError } 10200020 - The method to be called is not callable or is an async method or a generator.\n     * @throws { BusinessError } 10200021 - Waiting for a global call timed out.\n     * @syscap SystemCapability.Utils.Lang\n     * @crossplatform\n     * @since 11\n     */\n    /**\n     * Calls a method of an object registered with the host thread. This API is called by the Worker thread.\n     * The invoking is synchronous for the Worker thread and asynchronous for the host thread. The return value is transferred through serialization.\n     *\n     * @param { string } instanceName - Key used for registration. It is used to search for the object in the host thread.\n     * @param { string } methodName - Name of the method to call. Note that the method cannot be modified by async or generator,\n     *     or return results asynchronously by using the asynchronous mechanism at the bottom layer. Otherwise, an exception is thrown.\n     * @param { number } timeout - Maximum duration that the current synchronous invoking waits, in ms.\n     *     The value is an integer ranging from 1 to 5000. The value 0 means that the 5000 ms duration is used.\n     * @param { Object[] } args - the method argument called on registered globalCallObject.\n     * @returns { Object } Return the result of method if it has a return value, otherwise return void.\n     * @throws { BusinessError } 401 - Parameter error. Possible causes:\n     * 1.Mandatory parameters are left unspecified;\n     * 2.Incorrect parameter types;\n     * 3.Parameter verification failed.\n     * @throws { BusinessError } 10200004 - Worker instance is not running.\n     * @throws { BusinessError } 10200006 - An exception occurred during serialization.\n     * @throws { BusinessError } 10200019 - The globalCallObject is not registered.\n     * @throws { BusinessError } 10200020 - The method to be called is not callable or is an async method or a generator.\n     * @throws { BusinessError } 10200021 - The global call exceeds the timeout.\n     * @syscap SystemCapability.Utils.Lang\n     * @crossplatform\n     * @atomicservice\n     * @since 12\n     */\n    callGlobalCallObjectMethod(instanceName: string, methodName: string, timeout: number, ...args: Object[]): Object;\n}\n/**\n * The event handler to be called when an exception occurs during worker execution.\n *\n * @typedef { function } ErrorCallback\n * @param { ErrorEvent } err - Error event class, which provides detailed information about the exception occurred during Worker execution.\n * @returns { void }\n * @syscap SystemCapability.Utils.Lang\n * @atomicservice\n * @since 18\n */\ntype ErrorCallback = (err: ErrorEvent) => void;\n/**\n * JS cross-thread communication tool\n *\n * @namespace worker\n * @syscap SystemCapability.Utils.Lang\n * @since 7\n */\n/**\n * JS cross-thread communication tool\n *\n * @namespace worker\n * @syscap SystemCapability.Utils.Lang\n * @crossplatform\n * @since 10\n */\n/**\n * JS cross-thread communication tool\n *\n * @namespace worker\n * @syscap SystemCapability.Utils.Lang\n * @crossplatform\n * @atomicservice\n * @since 11\n */\ndeclare namespace worker {\n    /**\n     * The ThreadWorker class contains all Worker functions.\n     *\n     * @syscap SystemCapability.Utils.Lang\n     * @since 9\n     */\n    /**\n     * The ThreadWorker class contains all Worker functions.\n     *\n     * @syscap SystemCapability.Utils.Lang\n     * @crossplatform\n     * @since 10\n     */\n    /**\n     * Before using the following APIs, you must create a ThreadWorker instance. The ThreadWorker class inherits from WorkerEventTarget.\n     *\n     * @implements WorkerEventTarget\n     * @syscap SystemCapability.Utils.Lang\n     * @crossplatform\n     * @atomicservice\n     * @since 11\n     */\n    class ThreadWorker implements WorkerEventTarget {\n        /**\n         * Creates a worker instance\n         *\n         * @param { string } scriptURL - scriptURL URL of the script to be executed by the worker\n         * @param { WorkerOptions } [options] - options Options that can be set for the worker\n         * @throws { BusinessError } 401 - Parameter error. Possible causes:\n         * 1.Mandatory parameters are left unspecified;\n         * 2.Incorrect parameter types;\n         * 3.Parameter verification failed.\n         * @throws { BusinessError } 10200003 - Worker initialization failed.\n         * @throws { BusinessError } 10200007 - The worker file path is invalid.\n         * @syscap SystemCapability.Utils.Lang\n         * @since 9\n         */\n        /**\n         * Creates a worker instance\n         *\n         * @param { string } scriptURL - scriptURL URL of the script to be executed by the worker\n         * @param { WorkerOptions } [options] - options Options that can be set for the worker\n         * @throws { BusinessError } 401 - Parameter error. Possible causes:\n         * 1.Mandatory parameters are left unspecified;\n         * 2.Incorrect parameter types;\n         * 3.Parameter verification failed.\n         * @throws { BusinessError } 10200003 - Worker initialization failed.\n         * @throws { BusinessError } 10200007 - The worker file path is invalid.\n         * @syscap SystemCapability.Utils.Lang\n         * @crossplatform\n         * @since 10\n         */\n        /**\n         * A constructor used to create a ThreadWorker instance.\n         *\n         * @param { string } scriptURL - URL of the Worker thread file. For details about the rules, see Precautions for File URLs.\n         * @param { WorkerOptions } [options] - Options that can be set for the Worker instance.\n         * @throws { BusinessError } 401 - Parameter error. Possible causes:\n         * 1.Mandatory parameters are left unspecified;\n         * 2.Incorrect parameter types;\n         * 3.Parameter verification failed.\n         * @throws { BusinessError } 10200003 - Worker initialization failed.\n         * @throws { BusinessError } 10200007 - The worker file path is invalid.\n         * @syscap SystemCapability.Utils.Lang\n         * @crossplatform\n         * @atomicservice\n         * @since 11\n         */\n        constructor(scriptURL: string, options?: WorkerOptions);\n        /**\n         * The onexit attribute of the worker specifies the event handler to be called\n         * when the worker exits. The handler is executed in the host thread.\n         *\n         * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Incorrect parameter types.\n         * @throws { BusinessError } 10200004 - The Worker instance is not running.\n         * @throws { BusinessError } 10200005 - The called API is not supported in the worker thread.\n         * @syscap SystemCapability.Utils.Lang\n         * @since 9\n         */\n        /**\n         * The onexit attribute of the worker specifies the event handler to be called\n         * when the worker exits. The handler is executed in the host thread.\n         *\n         * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Incorrect parameter types.\n         * @throws { BusinessError } 10200004 - The Worker instance is not running.\n         * @throws { BusinessError } 10200005 - The called API is not supported in the worker thread.\n         * @syscap SystemCapability.Utils.Lang\n         * @crossplatform\n         * @since 10\n         */\n        /**\n         * Called when the Worker thread exits. The event handler is executed in the host thread. In the callback function,\n         * the code value is of the number type, where the value 1 indicates abnormal exit and 0 indicates normal exit.\n         *\n         * @type { ?function }\n         * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Incorrect parameter types.\n         * @throws { BusinessError } 10200004 - The Worker instance is not running.\n         * @throws { BusinessError } 10200005 - The called API is not supported in the worker thread.\n         * @syscap SystemCapability.Utils.Lang\n         * @crossplatform\n         * @atomicservice\n         * @since 11\n         */\n        onexit?: (code: number) => void;\n        /**\n         * The onerror attribute of the worker specifies the event handler to be called\n         * when an exception occurs during worker execution.\n         * The event handler is executed in the host thread.\n         *\n         * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Incorrect parameter types.\n         * @throws { BusinessError } 10200004 - The Worker instance is not running.\n         * @throws { BusinessError } 10200005 - The called API is not supported in the worker thread.\n         * @syscap SystemCapability.Utils.Lang\n         * @since 9\n         */\n        /**\n         * The onerror attribute of the worker specifies the event handler to be called\n         * when an exception occurs during worker execution.\n         * The event handler is executed in the host thread.\n         *\n         * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Incorrect parameter types.\n         * @throws { BusinessError } 10200004 - The Worker instance is not running.\n         * @throws { BusinessError } 10200005 - The called API is not supported in the worker thread.\n         * @syscap SystemCapability.Utils.Lang\n         * @crossplatform\n         * @since 10\n         */\n        /**\n         * Called when an exception occurs during worker execution. The event handler is executed in the host thread.\n         * In the callback function, the err type is ErrorEvent, indicating the received abnormal data.\n         *\n         * @type { ?function }\n         * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Incorrect parameter types.\n         * @throws { BusinessError } 10200004 - The Worker instance is not running.\n         * @throws { BusinessError } 10200005 - The called API is not supported in the worker thread.\n         * @syscap SystemCapability.Utils.Lang\n         * @crossplatform\n         * @atomicservice\n         * @since 11\n         */\n        onerror?: (err: ErrorEvent) => void;\n        /**\n         * Called when an exception occurs within the lifecycle of the Worker thread. The event handler is executed in the host thread.\n         *\n         * onerror can capture only exceptions generated by synchronous methods within the onmessage callback.\n         * It cannot capture exceptions from multithreaded callbacks or modularization-related exceptions.\n         * Once an exception is captured, the Worker thread will proceed to the destruction process and cannot be used.\n         *\n         * onAllErrors can capture global exceptions generated during the onmessage callback, timer callback,\n         * and file execution of the Worker thread. After an exception is captured by onAllErrors,\n         * the Worker thread remains alive and can continue to be used. You are advised to use onAllErrors instead of onerror.\n         *\n         * @type { ?function }\n         * @throws { BusinessError } 10200004 - The Worker instance is not running.\n         * @throws { BusinessError } 10200005 - The called API is not supported in the worker thread.\n         * @syscap SystemCapability.Utils.Lang\n         * @atomicservice\n         * @since 18\n         */\n        onAllErrors?: ErrorCallback;\n        /**\n         * The onmessage attribute of the worker specifies the event handler\n         * to be called then the host thread receives a message created by itself\n         * and sent by the worker through the parentPort.postMessage.\n         * The event handler is executed in the host thread.\n         *\n         * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Incorrect parameter types.\n         * @throws { BusinessError } 10200004 - The Worker instance is not running.\n         * @throws { BusinessError } 10200005 - The called API is not supported in the worker thread.\n         * @syscap SystemCapability.Utils.Lang\n         * @since 9\n         */\n        /**\n         * The onmessage attribute of the worker specifies the event handler\n         * to be called then the host thread receives a message created by itself\n         * and sent by the worker through the parentPort.postMessage.\n         * The event handler is executed in the host thread.\n         *\n         * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Incorrect parameter types.\n         * @throws { BusinessError } 10200004 - The Worker instance is not running.\n         * @throws { BusinessError } 10200005 - The called API is not supported in the worker thread.\n         * @syscap SystemCapability.Utils.Lang\n         * @crossplatform\n         * @since 10\n         */\n        /**\n         * Called when the host thread receives a message sent by the Worker thread through workerPort.postMessage.\n         * The event handler is executed in the host thread. In the callback function, the event type is MessageEvents, indicating the received message data.\n         *\n         * @type { ?function }\n         * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Incorrect parameter types.\n         * @throws { BusinessError } 10200004 - The Worker instance is not running.\n         * @throws { BusinessError } 10200005 - The called API is not supported in the worker thread.\n         * @syscap SystemCapability.Utils.Lang\n         * @crossplatform\n         * @atomicservice\n         * @since 11\n         */\n        onmessage?: (event: MessageEvents) => void;\n        /**\n         * The onmessage attribute of the worker specifies the event handler\n         * when the worker receives a message that cannot be serialized.\n         * The event handler is executed in the host thread.\n         *\n         * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Incorrect parameter types.\n         * @throws { BusinessError } 10200004 - The Worker instance is not running.\n         * @throws { BusinessError } 10200005 - The called API is not supported in the worker thread.\n         * @syscap SystemCapability.Utils.Lang\n         * @since 9\n         */\n        /**\n         * The onmessage attribute of the worker specifies the event handler\n         * when the worker receives a message that cannot be serialized.\n         * The event handler is executed in the host thread.\n         *\n         * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Incorrect parameter types.\n         * @throws { BusinessError } 10200004 - The Worker instance is not running.\n         * @throws { BusinessError } 10200005 - The called API is not supported in the worker thread.\n         * @syscap SystemCapability.Utils.Lang\n         * @crossplatform\n         * @since 10\n         */\n        /**\n         * Called when the Worker thread receives a message that cannot be serialized. The event handler is executed in the host thread.\n         * In the callback function, the event type is MessageEvents, indicating the received message data.\n         *\n         * @type { ?function }\n         * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Incorrect parameter types.\n         * @throws { BusinessError } 10200004 - The Worker instance is not running.\n         * @throws { BusinessError } 10200005 - The called API is not supported in the worker thread.\n         * @syscap SystemCapability.Utils.Lang\n         * @crossplatform\n         * @atomicservice\n         * @since 11\n         */\n        onmessageerror?: (event: MessageEvents) => void;\n        /**\n         * Sends a message to the worker thread.\n         * The data is transferred using the structured clone algorithm.\n         *\n         * @param { Object } message - message Data to be sent to the worker\n         * @param { ArrayBuffer[] } transfer - transfer ArrayBuffer instance that can be transferred.\n         * The transferList array cannot contain null.\n         * @throws { BusinessError } 401 - if the input parameters are invalid.\n         * @throws { BusinessError } 10200004 - The Worker instance is not running.\n         * @throws { BusinessError } 10200006 - An exception occurred during serialization.\n         * @syscap SystemCapability.Utils.Lang\n         * @since 9\n         */\n        /**\n         * Sends a message to the worker thread.\n         * The data is transferred using the structured clone algorithm.\n         *\n         * @param { Object } message - message Data to be sent to the worker\n         * @param { ArrayBuffer[] } transfer - transfer ArrayBuffer instance that can be transferred.\n         * The transferList array cannot contain null.\n         * @throws { BusinessError } 401 - Parameter error. Possible causes:\n         * 1.Mandatory parameters are left unspecified;\n         * 2.Incorrect parameter types;\n         * 3.Parameter verification failed.\n         * @throws { BusinessError } 10200004 - The Worker instance is not running.\n         * @throws { BusinessError } 10200006 - An exception occurred during serialization.\n         * @syscap SystemCapability.Utils.Lang\n         * @crossplatform\n         * @since 10\n         */\n        /**\n         * Sends a message from the host thread to the Worker thread by transferring object ownership.\n         *\n         * @param { Object } message - Data to be sent to the Worker thread. The data object must be sequenceable.\n         *     For details about the supported parameter types, see Sequenceable Data Types.\n         * @param { ArrayBuffer[] } transfer - ArrayBuffer instance holding an array of objects for which the ownership\n         *     is transferred to the Worker thread. After the transfer, the objects are available only in the Worker thread. The array cannot be null.\n         * @throws { BusinessError } 401 - Parameter error. Possible causes:\n         * 1.Mandatory parameters are left unspecified;\n         * 2.Incorrect parameter types;\n         * 3.Parameter verification failed.\n         * @throws { BusinessError } 10200004 - The Worker instance is not running.\n         * @throws { BusinessError } 10200006 - An exception occurred during serialization.\n         * @syscap SystemCapability.Utils.Lang\n         * @crossplatform\n         * @atomicservice\n         * @since 11\n         */\n        postMessage(message: Object, transfer: ArrayBuffer[]): void;\n        /**\n         * Sends a message to the worker thread.\n         * The data is transferred using the structured clone algorithm.\n         *\n         * @param { Object } message - message Data to be sent to the worker\n         * @param { PostMessageOptions } [options] - options\n         * @throws { BusinessError } 401 - Parameter error. Possible causes:\n         * 1.Mandatory parameters are left unspecified;\n         * 2.Incorrect parameter types;\n         * 3.Parameter verification failed.\n         * @throws { BusinessError } 10200004 - The Worker instance is not running.\n         * @throws { BusinessError } 10200006 - An exception occurred during serialization.\n         * @syscap SystemCapability.Utils.Lang\n         * @since 9\n         */\n        /**\n         * Sends a message to the worker thread.\n         * The data is transferred using the structured clone algorithm.\n         *\n         * @param { Object } message - message Data to be sent to the worker\n         * @param { PostMessageOptions } [options] - options\n         * @throws { BusinessError } 401 - Parameter error. Possible causes:\n         * 1.Mandatory parameters are left unspecified;\n         * 2.Incorrect parameter types;\n         * 3.Parameter verification failed.\n         * @throws { BusinessError } 10200004 - The Worker instance is not running.\n         * @throws { BusinessError } 10200006 - An exception occurred during serialization.\n         * @syscap SystemCapability.Utils.Lang\n         * @crossplatform\n         * @since 10\n         */\n        /**\n         * Sends a message from the host thread to the Worker thread by transferring object ownership or copying data.\n         *\n         * @param { Object } message - Data to be sent to the Worker thread. The data object must be sequenceable.\n         *     For details about the supported parameter types, see Sequenceable Data Types.\n         * @param { PostMessageOptions } [options] - If this parameter is specified, it functions the same as ArrayBuffer[].\n         *     Specifically, the ownership of the objects in the array is transferred to the Worker thread and becomes unavailable in the host thread.\n         *     The objects are available only in the Worker thread. If this parameter is not specified, the default value undefined is used,\n         *     and information is transferred to the Worker thread by copying data.\n         * @throws { BusinessError } 401 - Parameter error. Possible causes:\n         * 1.Mandatory parameters are left unspecified;\n         * 2.Incorrect parameter types;\n         * 3.Parameter verification failed.\n         * @throws { BusinessError } 10200004 - The Worker instance is not running.\n         * @throws { BusinessError } 10200006 - An exception occurred during serialization.\n         * @syscap SystemCapability.Utils.Lang\n         * @crossplatform\n         * @atomicservice\n         * @since 11\n         */\n        postMessage(message: Object, options?: PostMessageOptions): void;\n        /**\n         * Sends a message from the host thread to the Worker thread. In the message, a sendable object is passed by reference,\n         * and a non-sendable object is passed by serialization.\n         *\n         * @param { Object } message - Data to be sent to the Worker thread. The data object must be sequenceable or sendable.\n         *     For details about the supported sequenceable types, see Sequenceable Data Types.\n         *     For details about the supported sendable types, see Sendable Data Types.\n         * @param { ArrayBuffer[] } [transfer] - ArrayBuffer instance holding an array of objects for which the ownership\n         *     is transferred to the Worker thread. After the transfer, the objects are available only in the Worker thread.\n         *     The array cannot be null. The default value is an empty array.\n         * @throws { BusinessError } 401 - Parameter error. Possible causes:\n         * 1.Mandatory parameters are left unspecified;\n         * 2.Incorrect parameter types;\n         * 3.Parameter verification failed.\n         * @throws { BusinessError } 10200004 - The Worker instance is not running.\n         * @throws { BusinessError } 10200006 - An exception occurred during serialization.\n         * @syscap SystemCapability.Utils.Lang\n         * @crossplatform\n         * @atomicservice\n         * @since 12\n         */\n        postMessageWithSharedSendable(message: Object, transfer?: ArrayBuffer[]): void;\n        /**\n         * Adds an event listener to the worker.\n         *\n         * @param { string } type - type Adds an event listener to the worker.\n         * @param { WorkerEventListener } listener - listener Callback to invoke when an event of the specified type occurs.\n         * @throws { BusinessError } 401 - Parameter error. Possible causes:\n         * 1.Mandatory parameters are left unspecified;\n         * 2.Incorrect parameter types;\n         * 3.Parameter verification failed.\n         * @throws { BusinessError } 10200004 - The Worker instance is not running.\n         * @throws { BusinessError } 10200005 - The called API is not supported in the worker thread.\n         * @syscap SystemCapability.Utils.Lang\n         * @since 9\n         */\n        /**\n         * Adds an event listener to the worker.\n         *\n         * @param { string } type - type Adds an event listener to the worker.\n         * @param { WorkerEventListener } listener - listener Callback to invoke when an event of the specified type occurs.\n         * @throws { BusinessError } 401 - Parameter error. Possible causes:\n         * 1.Mandatory parameters are left unspecified;\n         * 2.Incorrect parameter types;\n         * 3.Parameter verification failed.\n         * @throws { BusinessError } 10200004 - The Worker instance is not running.\n         * @throws { BusinessError } 10200005 - The called API is not supported in the worker thread.\n         * @syscap SystemCapability.Utils.Lang\n         * @crossplatform\n         * @since 10\n         */\n        /**\n         * Adds an event listener for the Worker thread. This API provides the same functionality as addEventListener9+.\n         *\n         * @param { string } type - Type of the event to listen for.\n         * @param { WorkerEventListener } listener - Callback to invoke when an event of the specified type occurs.\n         * @throws { BusinessError } 401 - Parameter error. Possible causes:\n         * 1.Mandatory parameters are left unspecified;\n         * 2.Incorrect parameter types;\n         * 3.Parameter verification failed.\n         * @throws { BusinessError } 10200004 - Worker instance is not running.\n         * @throws { BusinessError } 10200005 - The invoked API is not supported in workers.\n         * @syscap SystemCapability.Utils.Lang\n         * @crossplatform\n         * @atomicservice\n         * @since 12\n         */\n        on(type: string, listener: WorkerEventListener): void;\n        /**\n         * Adds an event listener to the worker\n         * and removes the event listener automatically after it is invoked once.\n         *\n         * @param { string } type - type Type of the event to listen for\n         * @param { WorkerEventListener } listener - listener Callback to invoke when an event of the specified type occurs\n         * @throws { BusinessError } 401 - Parameter error. Possible causes:\n         * 1.Mandatory parameters are left unspecified;\n         * 2.Incorrect parameter types;\n         * 3.Parameter verification failed.\n         * @throws { BusinessError } 10200004 - The Worker instance is not running.\n         * @throws { BusinessError } 10200005 - The called API is not supported in the worker thread.\n         * @syscap SystemCapability.Utils.Lang\n         * @since 9\n         */\n        /**\n         * Adds an event listener to the worker\n         * and removes the event listener automatically after it is invoked once.\n         *\n         * @param { string } type - type Type of the event to listen for\n         * @param { WorkerEventListener } listener - listener Callback to invoke when an event of the specified type occurs\n         * @throws { BusinessError } 401 - Parameter error. Possible causes:\n         * 1.Mandatory parameters are left unspecified;\n         * 2.Incorrect parameter types;\n         * 3.Parameter verification failed.\n         * @throws { BusinessError } 10200004 - The Worker instance is not running.\n         * @throws { BusinessError } 10200005 - The called API is not supported in the worker thread.\n         * @syscap SystemCapability.Utils.Lang\n         * @crossplatform\n         * @since 10\n         */\n        /**\n         * Adds an event listener for the Worker thread and removes the event listener after it is invoked once.\n         *\n         * @param { string } type - type Type of the event to listen for\n         * @param { WorkerEventListener } listener - listener Callback to invoke when an event of the specified type occurs\n         * @throws { BusinessError } 401 - Parameter error. Possible causes:\n         * 1.Mandatory parameters are left unspecified;\n         * 2.Incorrect parameter types;\n         * 3.Parameter verification failed.\n         * @throws { BusinessError } 10200004 - Worker instance is not running.\n         * @throws { BusinessError } 10200005 - The invoked API is not supported in workers.\n         * @syscap SystemCapability.Utils.Lang\n         * @crossplatform\n         * @atomicservice\n         * @since 12\n         */\n        once(type: string, listener: WorkerEventListener): void;\n        /**\n         * Removes an event listener to the worker.\n         *\n         * @param { string } type - type Type of the event for which the event listener is removed.\n         * @param { WorkerEventListener } [listener] - listener Callback of the event listener to remove.\n         * @throws { BusinessError } 401 - Parameter error. Possible causes:\n         * 1.Mandatory parameters are left unspecified;\n         * 2.Incorrect parameter types;\n         * 3.Parameter verification failed.\n         * @throws { BusinessError } 10200004 - The Worker instance is not running.\n         * @throws { BusinessError } 10200005 - The called API is not supported in the worker thread.\n         * @syscap SystemCapability.Utils.Lang\n         * @since 9\n         */\n        /**\n         * Removes an event listener to the worker.\n         *\n         * @param { string } type - type Type of the event for which the event listener is removed.\n         * @param { WorkerEventListener } [listener] - listener Callback of the event listener to remove.\n         * @throws { BusinessError } 401 - Parameter error. Possible causes:\n         * 1.Mandatory parameters are left unspecified;\n         * 2.Incorrect parameter types;\n         * 3.Parameter verification failed.\n         * @throws { BusinessError } 10200004 - The Worker instance is not running.\n         * @throws { BusinessError } 10200005 - The called API is not supported in the worker thread.\n         * @syscap SystemCapability.Utils.Lang\n         * @crossplatform\n         * @since 10\n         */\n        /**\n         * Removes an event listener for the Worker thread. This API provides the same functionality as removeEventListener9+.\n         *\n         * @param { string } type - type Type of the event for which the event listener is removed.\n         * @param { WorkerEventListener } [listener] - listener Callback of the event listener to remove.\n         * @throws { BusinessError } 401 - Parameter error. Possible causes:\n         * 1.Mandatory parameters are left unspecified;\n         * 2.Incorrect parameter types;\n         * 3.Parameter verification failed.\n         * @throws { BusinessError } 10200004 - Worker instance is not running.\n         * @throws { BusinessError } 10200005 - The invoked API is not supported in workers.\n         * @syscap SystemCapability.Utils.Lang\n         * @crossplatform\n         * @atomicservice\n         * @since 12\n         */\n        off(type: string, listener?: WorkerEventListener): void;\n        /**\n         * Terminates the worker thread to stop the worker from receiving messages\n         *\n         * @throws { BusinessError } 10200004 - The Worker instance is not running.\n         * @syscap SystemCapability.Utils.Lang\n         * @since 9\n         */\n        /**\n         * Terminates the worker thread to stop the worker from receiving messages\n         *\n         * @throws { BusinessError } 10200004 - The Worker instance is not running.\n         * @syscap SystemCapability.Utils.Lang\n         * @crossplatform\n         * @since 10\n         */\n        /**\n         * Terminates the Worker thread to stop it from receiving messages.\n         *\n         * @throws { BusinessError } 10200004 - The Worker instance is not running.\n         * @syscap SystemCapability.Utils.Lang\n         * @crossplatform\n         * @atomicservice\n         * @since 11\n         */\n        terminate(): void;\n        /**\n         * Adds an event listener to the worker.\n         *\n         * @param { string } type - type Type of the event to listen for.\n         * @param { WorkerEventListener } listener Callback to invoke when an event of the specified type occurs.\n         * @throws { BusinessError } 401 - Parameter error. Possible causes:\n         * 1.Mandatory parameters are left unspecified;\n         * 2.Incorrect parameter types;\n         * 3.Parameter verification failed.\n         * @throws { BusinessError } 10200004 - The Worker instance is not running.\n         * @throws { BusinessError } 10200005 - The called API is not supported in the worker thread.\n         * @syscap SystemCapability.Utils.Lang\n         * @since 9\n         */\n        /**\n         * Adds an event listener to the worker.\n         *\n         * @param { string } type - type Type of the event to listen for.\n         * @param { WorkerEventListener } listener Callback to invoke when an event of the specified type occurs.\n         * @throws { BusinessError } 401 - Parameter error. Possible causes:\n         * 1.Mandatory parameters are left unspecified;\n         * 2.Incorrect parameter types;\n         * 3.Parameter verification failed.\n         * @throws { BusinessError } 10200004 - The Worker instance is not running.\n         * @throws { BusinessError } 10200005 - The called API is not supported in the worker thread.\n         * @syscap SystemCapability.Utils.Lang\n         * @crossplatform\n         * @since 10\n         */\n        /**\n         * Adds an event listener for the Worker thread. This API provides the same functionality as on9+.\n         *\n         * @param { string } type - type Type of the event to listen for.\n         * @param { WorkerEventListener } listener Callback to invoke when an event of the specified type occurs.\n         * @throws { BusinessError } 401 - Parameter error. Possible causes:\n         * 1.Mandatory parameters are left unspecified;\n         * 2.Incorrect parameter types;\n         * 3.Parameter verification failed.\n         * @throws { BusinessError } 10200004 - Worker instance is not running.\n         * @throws { BusinessError } 10200005 - The invoked API is not supported in workers.\n         * @syscap SystemCapability.Utils.Lang\n         * @crossplatform\n         * @atomicservice\n         * @since 12\n         */\n        addEventListener(type: string, listener: WorkerEventListener): void;\n        /**\n         * Handle the event defined for the worker.\n         *\n         * @param { Event } event - event Event to dispatch.\n         * @returns { boolean }\n         * @throws { BusinessError } 401 - Parameter error. Possible causes:\n         * 1.Mandatory parameters are left unspecified;\n         * 2.Incorrect parameter types;\n         * 3.Parameter verification failed.\n         * @throws { BusinessError } 10200004 - The Worker instance is not running.\n         * @syscap SystemCapability.Utils.Lang\n         * @since 9\n         */\n        /**\n         * Handle the event defined for the worker.\n         *\n         * @param { Event } event - event Event to dispatch.\n         * @returns { boolean }\n         * @throws { BusinessError } 401 - Parameter error. Possible causes:\n         * 1.Mandatory parameters are left unspecified;\n         * 2.Incorrect parameter types;\n         * 3.Parameter verification failed.\n         * @throws { BusinessError } 10200004 - The Worker instance is not running.\n         * @syscap SystemCapability.Utils.Lang\n         * @crossplatform\n         * @since 10\n         */\n        /**\n         * Dispatches the event defined for the Worker thread.\n         *\n         * @param { Event } event - event Event to dispatch.\n         * @returns { boolean }\n         * @throws { BusinessError } 401 - Parameter error. Possible causes:\n         * 1.Mandatory parameters are left unspecified;\n         * 2.Incorrect parameter types;\n         * 3.Parameter verification failed.\n         * @throws { BusinessError } 10200004 - Worker instance is not running.\n         * @syscap SystemCapability.Utils.Lang\n         * @crossplatform\n         * @atomicservice\n         * @since 12\n         */\n        dispatchEvent(event: Event): boolean;\n        /**\n         * Remove an event defined for the worker.\n         *\n         * @param { string } type - type Type of the event for which the event listener is cancelled.\n         * @param { WorkerEventListener } [callback] - callback Callback of the event listener to remove.\n         * @throws { BusinessError } 401 - Parameter error. Possible causes:\n         * 1.Mandatory parameters are left unspecified;\n         * 2.Incorrect parameter types;\n         * 3.Parameter verification failed.\n         * @throws { BusinessError } 10200004 - The Worker instance is not running.\n         * @syscap SystemCapability.Utils.Lang\n         * @since 9\n         */\n        /**\n         * Remove an event defined for the worker.\n         *\n         * @param { string } type - type Type of the event for which the event listener is cancelled.\n         * @param { WorkerEventListener } [callback] - callback Callback of the event listener to remove.\n         * @throws { BusinessError } 401 - Parameter error. Possible causes:\n         * 1.Mandatory parameters are left unspecified;\n         * 2.Incorrect parameter types;\n         * 3.Parameter verification failed.\n         * @throws { BusinessError } 10200004 - The Worker instance is not running.\n         * @syscap SystemCapability.Utils.Lang\n         * @crossplatform\n         * @since 10\n         */\n        /**\n         * Removes an event listener for the Worker thread. This API provides the same functionality as off9+.\n         *\n         * @param { string } type - type Type of the event for which the event listener is to be removed.\n         * @param { WorkerEventListener } [callback] - callback Callback to invoke when the listener is removed.\n         * @throws { BusinessError } 401 - Parameter error. Possible causes:\n         * 1.Mandatory parameters are left unspecified;\n         * 2.Incorrect parameter types;\n         * 3.Parameter verification failed.\n         * @throws { BusinessError } 10200004 - Worker instance is not running.\n         * @syscap SystemCapability.Utils.Lang\n         * @crossplatform\n         * @atomicservice\n         * @since 12\n         */\n        removeEventListener(type: string, callback?: WorkerEventListener): void;\n        /**\n         * Remove all event listeners for the worker.\n         *\n         * @throws { BusinessError } 10200004 - The Worker instance is not running.\n         * @syscap SystemCapability.Utils.Lang\n         * @since 9\n         */\n        /**\n         * Remove all event listeners for the worker.\n         *\n         * @throws { BusinessError } 10200004 - The Worker instance is not running.\n         * @syscap SystemCapability.Utils.Lang\n         * @crossplatform\n         * @since 10\n         */\n        /**\n         * Removes all event listeners for the Worker thread.\n         *\n         * @throws { BusinessError } 10200004 - Worker instance is not running.\n         * @syscap SystemCapability.Utils.Lang\n         * @crossplatform\n         * @atomicservice\n         * @since 12\n         */\n        removeAllListener(): void;\n        /**\n         * Register globalCallObject for global call.\n         * @param { string } instanceName - The key to register globalCallObject.\n         * @param { Object } globalCallObject - The globalCallObject that will be registered.\n         * @throws { BusinessError } 401 - Parameter error. Possible causes:\n         * 1.Mandatory parameters are left unspecified;\n         * 2.Incorrect parameter types;\n         * 3.Parameter verification failed.\n         * @throws { BusinessError } 10200004 - The Worker instance is not running.\n         * @syscap SystemCapability.Utils.Lang\n         * @crossplatform\n         * @since 11\n         */\n        /**\n         * Registers an object with the ThreadWorker instance of the host thread.\n         * In this way, the methods of the object can be called in the Worker thread through callGlobalCallObjectMethod.\n         *\n         * @param { string } instanceName - Key used for registration, based on which the registered object is identified during method calling.\n         * @param { Object } globalCallObject - Object to register. The ThreadWorker instance holds a strong reference to the object.\n         * @throws { BusinessError } 401 - Parameter error. Possible causes:\n         * 1.Mandatory parameters are left unspecified;\n         * 2.Incorrect parameter types;\n         * 3.Parameter verification failed.\n         * @throws { BusinessError } 10200004 - Worker instance is not running.\n         * @syscap SystemCapability.Utils.Lang\n         * @crossplatform\n         * @atomicservice\n         * @since 12\n         */\n        registerGlobalCallObject(instanceName: string, globalCallObject: Object): void;\n        /**\n         * Remove registered globalCallObject and release strong reference to registered object.\n         * @param { string } [instanceName] - The exact key that used in registration.\n         * @throws { BusinessError } 401 - Parameter error. Possible causes:\n         * 1.Mandatory parameters are left unspecified;\n         * 2.Incorrect parameter types;\n         * 3.Parameter verification failed.\n         * @throws { BusinessError } 10200004 - The Worker instance is not running.\n         * @syscap SystemCapability.Utils.Lang\n         * @crossplatform\n         * @since 11\n         */\n        /**\n         * Unregisters an object with the ThreadWorker instance of the host thread. This API releases the strong reference\n         * between the ThreadWorker instance and the target object. No error is reported if no object is matched.\n         *\n         * @param { string } [instanceName] - Key used for registration. If this parameter is left blank,\n         *     all registered objects registered in the ThreadWorker instance are unregistered.\n         * @throws { BusinessError } 401 - Parameter error. Possible causes:\n         * 1.Mandatory parameters are left unspecified;\n         * 2.Incorrect parameter types;\n         * 3.Parameter verification failed.\n         * @throws { BusinessError } 10200004 - Worker instance is not running.\n         * @syscap SystemCapability.Utils.Lang\n         * @crossplatform\n         * @atomicservice\n         * @since 12\n         */\n        unregisterGlobalCallObject(instanceName?: string): void;\n    }\n    /**\n     * The Worker class contains all Worker functions.\n     *\n     * @syscap SystemCapability.Utils.Lang\n     * @since 7\n     * @deprecated since 9\n     * @useinstead ohos.worker.ThreadWorker\n     */\n    class Worker implements EventTarget {\n        /**\n         * Creates a worker instance\n         *\n         * @param { string } scriptURL - scriptURL URL of the script to be executed by the worker\n         * @param { WorkerOptions } options - options Options that can be set for the worker\n         * @syscap SystemCapability.Utils.Lang\n         * @since 7\n         * @deprecated since 9\n         * @useinstead ohos.worker.ThreadWorker.constructor\n         */\n        constructor(scriptURL: string, options?: WorkerOptions);\n        /**\n         * The onexit attribute of the worker specifies the event handler to be called\n         * when the worker exits. The handler is executed in the host thread.\n         *\n         * @syscap SystemCapability.Utils.Lang\n         * @since 7\n         * @deprecated since 9\n         * @useinstead ohos.worker.ThreadWorker.onexit\n         */\n        onexit?: (code: number) => void;\n        /**\n         * The onerror attribute of the worker specifies the event handler to be called\n         * when an exception occurs during worker execution.\n         * The event handler is executed in the host thread.\n         *\n         * @syscap SystemCapability.Utils.Lang\n         * @since 7\n         * @deprecated since 9\n         * @useinstead ohos.worker.ThreadWorker.onerror\n         */\n        onerror?: (err: ErrorEvent) => void;\n        /**\n         * The onmessage attribute of the worker specifies the event handler\n         * to be called then the host thread receives a message created by itself\n         * and sent by the worker through the parentPort.postMessage.\n         * The event handler is executed in the host thread.\n         *\n         * @syscap SystemCapability.Utils.Lang\n         * @since 7\n         * @deprecated since 9\n         * @useinstead ohos.worker.ThreadWorker.onmessage\n         */\n        onmessage?: (event: MessageEvent) => void;\n        /**\n         * The onmessage attribute of the worker specifies the event handler\n         * when the worker receives a message that cannot be serialized.\n         * The event handler is executed in the host thread.\n         *\n         * @syscap SystemCapability.Utils.Lang\n         * @since 7\n         * @deprecated since 9\n         * @useinstead ohos.worker.ThreadWorker.onmessageerror\n         */\n        onmessageerror?: (event: MessageEvent) => void;\n        /**\n         * Sends a message to the worker thread.\n         * The data is transferred using the structured clone algorithm.\n         *\n         * @param { Object } message - message - message Data to be sent to the worker\n         * @param { ArrayBuffer[] } transfer - transfer ArrayBuffer instance that can be transferred.\n         * The transferList array cannot contain null.\n         * @syscap SystemCapability.Utils.Lang\n         * @since 7\n         * @deprecated since 9\n         * @useinstead ohos.worker.ThreadWorker.postMessage\n         */\n        postMessage(message: Object, transfer: ArrayBuffer[]): void;\n        /**\n         * Sends a message to the worker thread.\n         * The data is transferred using the structured clone algorithm.\n         *\n         * @param { Object } message - message - message Data to be sent to the worker\n         * @param { PostMessageOptions } [options] - options Option can be set for postmessage.\n         * The transferList array cannot contain null.\n         * @syscap SystemCapability.Utils.Lang\n         * @since 7\n         * @deprecated since 9\n         * @useinstead ohos.worker.ThreadWorker.postMessage\n         */\n        postMessage(message: Object, options?: PostMessageOptions): void;\n        /**\n         * Adds an event listener to the worker.\n         *\n         * @param { string } type - type Adds an event listener to the worker.\n         * @param { EventListener } listener - listener Callback to invoke when an event of the specified type occurs.\n         * @syscap SystemCapability.Utils.Lang\n         * @since 7\n         * @deprecated since 9\n         * @useinstead ohos.worker.ThreadWorker.on\n         */\n        on(type: string, listener: EventListener): void;\n        /**\n         * Adds an event listener to the worker\n         * and removes the event listener automatically after it is invoked once.\n         *\n         * @param { string } type - type Type of the event to listen for\n         * @param { EventListener } listener - listener Callback to invoke when an event of the specified type occurs\n         * @syscap SystemCapability.Utils.Lang\n         * @since 7\n         * @deprecated since 9\n         * @useinstead ohos.worker.ThreadWorker.once\n         */\n        once(type: string, listener: EventListener): void;\n        /**\n         * Removes an event listener to the worker.\n         *\n         * @param { string } type - type Type of the event for which the event listener is removed.\n         * @param { EventListener } listener - listener Callback of the event listener to remove.\n         * @syscap SystemCapability.Utils.Lang\n         * @since 7\n         * @deprecated since 9\n         * @useinstead ohos.worker.ThreadWorker.off\n         */\n        off(type: string, listener?: EventListener): void;\n        /**\n         * Terminates the worker thread to stop the worker from receiving messages\n         *\n         * @syscap SystemCapability.Utils.Lang\n         * @since 7\n         * @deprecated since 9\n         * @useinstead ohos.worker.ThreadWorker.terminate\n         */\n        terminate(): void;\n    }\n    /**\n     * The object used by the worker thread to communicate with the host thread.\n     *\n     * @constant\n     * @syscap SystemCapability.Utils.Lang\n     * @since 7\n     * @deprecated since 9\n     * @useinstead ohos.worker.workerPort\n     */\n    const parentPort: DedicatedWorkerGlobalScope;\n    /**\n     * The object used by the worker thread to communicate with the host thread.\n     *\n     * @constant\n     * @syscap SystemCapability.Utils.Lang\n     * @since 9\n     */\n    /**\n     * The object used by the worker thread to communicate with the host thread.\n     *\n     * @constant\n     * @syscap SystemCapability.Utils.Lang\n     * @crossplatform\n     * @since 10\n     */\n    /**\n     * The object used by the worker thread to communicate with the host thread.\n     *\n     * @syscap SystemCapability.Utils.Lang\n     * @crossplatform\n     * @atomicservice\n     * @since 11\n     */\n    const workerPort: ThreadWorkerGlobalScope;\n}\nexport default worker;\n",
}
export default FILE;